/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2014.10.23                                          *
 * Description:      build unstructured mesh from file                   *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_mesh_MeshReader_h
#define FreeMAPs_include_COMMON_mesh_MeshReader_h

#include "FreeMAPsConfig.h"

//LIBMESH headers
//#include "LIBMESH/geom/point.h"

//COMMON headers
#include "COMMON/base/StateIndicator.h"
#include "COMMON/enum/MeshPackage.h"
#include "COMMON/enum/MeshFileFormat.h"
//#include "COMMON/enum/ElemType.h"
//#include "COMMON/mesh/Elem.h"

namespace FreeMAPs
{

//forward declarations
class MeshGroup;

class MeshReader : public StateIndicator
{
public:
    MeshReader();

    ~MeshReader();

public:

    inline MeshPackage
    get_mesh_package() const;

    inline MeshFileFormat
    get_mesh_file_format() const;

    inline void
    set_mesh_file_format(const MeshFileFormat mesh_file_format);

    inline const std::string&
    get_mesh_file_location() const;

    inline void
    set_mesh_file_location(const std::string& mesh_file_location);


public:

    void
    get_from_input (
        const InputDatabase* db);

    friend std::ostream&
    operator << (
        std::ostream& os,
        const MeshReader& rhs);

    bool
    check_all_info_db(const InputDatabase* db);



private:

    typedef StateIndicator Parent;

    /*
     * when use unstructured mesh, tells the conerstone package
     * used to support it.
     *
     * note it it only worked when unstructured mesh is required.
     */
    MeshPackage d_mesh_package;

    /*
     * When using unstructured mesh, different formats of mesh ﬁle are supported.
     * (note that the structured ﬁle will be set by geom_info. so it is not required to
     * set it here.) now "GAMBIT", "TETGEN", "LS_DYNA" are supported.
     */
    MeshFileFormat d_mesh_file_format;

    /*
     * Tells the unstructured mesh file location. Absolute path is required.
     */
    std::string d_mesh_file_location;
};

}

#include "COMMON/mesh/MeshReader.inl"

#endif
